add_subdirectory(designerintegrationv2)
add_subdirectory(proparser)
add_subdirectory(qtsingleapplication)
add_subdirectory(qtlockedfile)
add_subdirectory(help)
add_subdirectory(registryaccess)

if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/qbs/CMakeLists.txt)
  set(BUILD_QBS_DEFAULT YES)
else()
  set(BUILD_QBS_DEFAULT FALSE)
endif()

option(BUILD_QBS "Build Qbs together with Qt Creator" ${BUILD_QBS_DEFAULT})

if (BUILD_QBS)
  find_package(Qt5 COMPONENTS Script QUIET)
  if (TARGET Qt5::Script)
    set(ENABLE_BUILD_QBS YES)
  endif()
else()
  set(ENABLE_BUILD_QBS NO)
endif()

add_feature_info("Build Qbs" ENABLE_BUILD_QBS "with CONDITION TARGET Qt5::Script")
if (ENABLE_BUILD_QBS)
  file(RELATIVE_PATH _REL_PATH_TO_QTC "${CMAKE_BINARY_DIR}" "${PROJECT_BINARY_DIR}")
  set(QBS_OUTPUT_PREFIX "${_REL_PATH_TO_QTC}/" CACHE STRING "" FORCE)
  set(QBS_APP_INSTALL_DIR "${IDE_BIN_PATH}" CACHE STRING "" FORCE)
  set(QBS_LIB_INSTALL_DIR "${IDE_LIBRARY_PATH}" CACHE STRING "" FORCE)
  set(QBS_DLL_INSTALL_DIR "${IDE_BIN_PATH}" CACHE STRING "" FORCE)
  set(QBS_LIBEXEC_INSTALL_DIR "${IDE_LIBEXEC_PATH}" CACHE STRING "" FORCE)
  set(QBS_PLUGINS_INSTALL_BASE "${IDE_PLUGIN_PATH}" CACHE STRING "" FORCE)
  set(QBS_RESOURCES_INSTALL_BASE "${IDE_DATA_PATH}/qbs" CACHE STRING "" FORCE)
  set(QBS_HEADERS_INSTALL_DIR "${IDE_DATA_PATH}/qbs/include/qbs" CACHE STRING "" FORCE)

  set(INSTALL_PUBLIC_HEADERS OFF)
  set(WITH_TESTS OFF)
  add_subdirectory(qbs)
endif()
